//
//  AY_BookQDItemCell.m
//  AiYue
//
//  Created by boWen on 2023/11/2.
//

#import "AY_BookQDItemCell.h"

@interface AY_BookQDItemCell ()
@property (strong,nonatomic) UIView * bg_View;
@property (strong,nonatomic) UILabel *topLabel;
@property (strong,nonatomic) UILabel *downLabel;
@property (strong,nonatomic) UIImageView *midImage;

@end

@implementation AY_BookQDItemCell


- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.bg_View = [AYTool createViewWithFrame:CGRectZero andBg:THEME_COLOR andRadius:YNUM(6) andAddSubView:self.contentView];
        [self.bg_View mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.top.bottom.equalTo(self.contentView);
        }];
        
        self.topLabel = [AYTool createLabelWithFrame:CGRectZero andText:@"" andTextColor:COLOR(@"#F86923") andBgColor:nil andFont:[UIFont boldSystemFontOfSize:YNUM(11)] andLines:1 andRadius:0 andAddSubView:self.bg_View];
        [self.topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.bg_View).offset(YNUM(8));
            make.centerX.equalTo(self.bg_View);
            make.height.mas_offset(YNUM(19));
        }];
        
        self.midImage = [AYTool createImageViewWithFrame:CGRectZero andImage:YImage(@"icon_wqd_own") andBg:nil andRadius:YNUM(4) andAddSubView:self.bg_View];
        [self.midImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.mas_equalTo(YNUM(36));
            make.height.mas_equalTo(YNUM(34));
            make.centerY.equalTo(self.bg_View).offset(YNUM(-1));
            make.centerX.equalTo(self.bg_View);
        }];
    
        self.downLabel = [AYTool createLabelWithFrame:CGRectZero andText:@"" andTextColor:COLOR(@"#F86923") andBgColor:nil andFont:[UIFont boldSystemFontOfSize:YNUM(12)] andLines:2 andRadius:0 andAddSubView:self.bg_View];
        [self.downLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.bg_View).offset(YNUM(-8));
            make.centerX.equalTo(self.bg_View);
            make.height.mas_offset(YNUM(20));
        }];
        
    }
    return self;
}

- (void)setQdListModel:(QianDListModel *)qdListModel {
    _qdListModel = qdListModel;
    self.topLabel.text = kStringUtils(qdListModel.itemName);
    self.downLabel.text = kStringUtils(qdListModel.rewardGold);
    if([kStringUtils(_qdListModel.signedFlag) isEqualToString:@"1"]) {
        self.bg_View.backgroundColor = THEME_COLOR;
        //已签到
        self.midImage.image = YImage(@"icon_yqd_own.png");
        self.topLabel.textColor = [UIColor whiteColor];
        self.downLabel.textColor = [UIColor whiteColor];
    }else {
        self.bg_View.backgroundColor = COLOR(@"#FFF0DD");
        self.midImage.image = YImage(@"icon_wqd_own.png");
        self.topLabel.textColor = COLOR(@"#F86923");
        self.downLabel.textColor = COLOR(@"#F86923");
    }
}

@end
